﻿

namespace Patterns4Net.ArchitectureExplorer.Diagram
{
    using System.Collections.Generic;
    using Patterns4Net.Core;

    public class Layer : DiagramElement
    {
        public Layer(string name, IEnumerable<Package> packages)
            : base(name)
        {
            this.Packages = packages;
            this.Packages.ForEach(x => x.Parent = this);
        }

        public IEnumerable<Package> Packages { get; private set; }

        public override void Accept(DiagramVisitor visitor)
        {
            visitor.Visit(this);
            foreach (var package in this.Packages)
            {
                package.Accept(visitor);
            }
        }
    }
}
